<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台管理系统</title>
<meta name="keywords" content="">
<meta name="description" content="">
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="css/ie6.css"/>
<![endif]-->
<link rel="stylesheet" type="text/css"  href="../../../../public/layui/css/layui.css">
<link href="../../../../public/admin/css/style_v2.0.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/style_v2.0.css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
</head>
<body>
<div class="position mt10">当前位置：<a href="{:U('Index/main')}">后台首页</a>  > <a href="{:U('Host/host')}">虚拟主机</a>  >  虚拟主机管理</div>
<div id="container">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>虚拟主机管理</legend>
</fieldset>
<div class="layui-form">
    <div class="layui-btn-group">
         <a href="{:U('host/host')}" class="layui-btn layui-btn-big"><i class="layui-icon">&#xe60a;</i>虚拟主机列表</a>&nbsp;
         <button class="layui-btn layui-btn-big"  data-method="notice" ><i class="layui-icon">&#xe654;</i> 添加虚拟主机</button>&nbsp;
         <a href="{:U('host/export_host/')}"  class="layui-btn layui-btn-big layui-btn-normal"><i class="layui-icon">&#xe62d;</i> 导出报表</a>&nbsp;
    </div>
</div>
<!--高级搜索-->
<div class="c"></div>
<div class="layui-form" style="background-color:#FFFFFF;">
<table class="layui-table" id="table">
    <thead>
    <tr style="text-align:center;">
      <th style="text-align:center;"></th>
      <th style="text-align:center;">ID</th>
      <th style="text-align:center;">主机名称</th>
      <th style="text-align:center;">绑定域名</th>
      <th style="text-align:center;">机房</th>
      <th style="text-align:center;">状态</th>
      <th style="text-align:center;">IP</th>
      <th style="text-align:center;">到期时间</th>
      <th style="text-align:center;">所在账号</th>
      <th>FTP</th>
      <th style="text-align:center;">控制面板</font></th>
      <th colspan="2" style="text-align:center;">操作</th>
    </tr> 
    </thead>
    <form id="form2" name="form2" method="post" action="{:U('Admin/Host/host_del/')}">  
     <volist name="list" id="r">
    <tr>
      <td  align="center" class="layui-form-item"><input type="checkbox" id="hid[]" title=""  lay-skin="primary"  name="hid[]" value="{$r.hid}"/></td>
      <td align="center">{$r.hid}</td>
      <td align="center" height="22px">{$r.hostname}</td>
      <td align="center" height="22px">{$r.hosturl}</td>
      <td  align="center">{$r.jifang}</td>
      <td  align="center"><if condition="$r['status'] eq 0"><font color="red">已过期</font><elseif condition="$r['status'] eq 1" /><font color="009688">正常</font><else />暂停</if></td>
      <td  align="center" >{$r.hostip}</td>
      <td  align="center" id="endtime">{$r.hostend|date="Y-m-d",###}</td>
      <td  align="center" >{$r.aname}</td>
      <td style="font-size:12px;">地址：{$r['ftp'][0]}:{$r['ftp']['1']}<br/>账号：{$r['ftp']['2']}<br/>密码：{$r['ftp']['3']}</td>
      <td  align="center" ><a href="{$r['panel']['0']}" target="_blank" title="登录控制面板" class="layui-btn layui-btn-small">控制面板</a></td>
      
      <td  align="center">
          <div class="layui-btn-group" style="width:130px; ">
          <a href="{:U('Admin/Host/hostfast_update/',array('hid' => $r['hid']))}" title="续费更新" class="layui-btn layui-btn-small">续费</a><a href="{:U('Admin/Host/host_edit/',array('hid' => $r['hid']))}" title="编辑" class="layui-btn layui-btn-small"><i class="layui-icon">&#xe642;</i></a><a href="{:U('Admin/Host/host_del',array('hid' => $r['hid']))}" class="layui-btn layui-btn-small layui-btn-danger" title="删除" onClick="return checkConfirm('您确认删除记录?')"><i class="layui-icon">&#xe640;</i></a>          </div>      </td>
    </tr>
    </volist>
    <tr>
      <td align="center"><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></td>
      <td colspan="16">
      <div style="padding-left:20px;">  
         <input type="button" value="全选" name="selectall" class="layui-btn" />
         <input type="button" value="反选" name="selectno" class="layui-btn "/>
         <button  name="btnDel" lay-submit="" lay-filter="btnDel" class="layui-btn layui-btn-danger" />删除</button>
      </div>      </td>
    </tr>
   </form>
    </table>
    <div class="c"></div>
    <div id="pages">{$page}</div>      
</div>
</div>
</body>
</html>
<form name=reg action="{:U('Admin/Host/host_update')}"  enctype="multipart/form-data"  method="post"  class="layui-form" id="host_add" style="display:none;">
<div class="layui-form">
    <table class="layui-table">
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>主机名称：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="hostname" type="text" id="hostname" value="" required  lay-verify="" placeholder="主机名称" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
     <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>绑定域名：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="hosturl" type="text" id="hosturl" value="" required  lay-verify="" placeholder="绑定域名" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>解析IP：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="hostip" type="text" id="hostip" value=""  lay-verify="" placeholder="解析IP" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>主机别名：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="cname" type="text" id="cname" value=""   lay-verify="" placeholder="主机别名" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>所属账号：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;">
          <select name="aid" lay-verify="" lay-filter="">
          <option value="">请选择账号</option>
           <volist name="account" id="a">
           <option value="{$a.aid}">{$a.aname}</option>
           </volist>
        </select>
      </span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>所在机房：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="jifang" type="text" id="jifang" value=""   lay-verify="" placeholder="所在机房" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>操作系统：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="hostos" type="text" id="hostos" value=""   lay-verify="" placeholder="操作系统" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
     <tr>
	  <td width="20%" align="right">状态：</td>
	  <td width="80%">
      <span class="table_span" style="float:left;">
      <input type="radio" name="status" value="1" title="正常运行" checked> &nbsp;&nbsp;&nbsp; 
      <input type="radio" name="status" value="0" title="已停止" >&nbsp;&nbsp;&nbsp; 
      <input type="radio" name="status" value="2" title="临时关闭" >&nbsp;&nbsp;&nbsp; 
      </span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>主机时间：</td>
	  <td width="80%">
      <span class="table_span" style="float:left;">
      <input name="hoststart" type="text" id="hoststart" value=""  placeholder="开始日"  class="layui-input ico-date"  style="width:120px; float:left;">
      </span>
      <span class="table_span">~</span>
      <input name="hostend" type="text" id="hostend" value=""  placeholder="结束日" class="layui-input ico-date"  style="width:120px; float:left;">
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>空间大小：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="space" type="text" id="space" value=""   lay-verify="" placeholder="空间大小(M)" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right">FTP账号：</td>
	  <td width="80%">
       <div class="fee_box"><span class="table_txt">FTP地址：</span><span style="width:280px; float:left;"><input name="ftp[0]" type="text" id="remote" value=""  autocomplete="off" class="layui-input" placeholder="" ></span>
       <span class="table_txt">端口：</span><span style="width:60px; float:left;"><input name="ftp[1]" type="text" id="remote" value="21"  autocomplete="off" class="layui-input" placeholder="" ></span>
       </div>
       <div class="fee_box"><span class="table_txt">FTP账号：</span><span style="width:280px; float:left;"><input name="ftp[2]" type="text" id="ftp" value=""  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">FTP密码：</span><span style="width:280px; float:left;"><input name="ftp[3]" type="text" id="ftp" value=""  autocomplete="off" class="layui-input" placeholder="" ></span></div>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right">数据库账号：</td>
	  <td width="80%">
       <div class="fee_box"><span class="table_txt">数据库地址：</span><span style="width:280px; float:left;"><input name="database[0]" type="text" id="database" value=""  autocomplete="off" class="layui-input" placeholder="" ></span>
       <span class="table_txt">端口：</span><span style="width:60px; float:left;"><input name="database[1]" type="text" id="database" value="3306"  autocomplete="off" class="layui-input" placeholder="" ></span>
       </div>
       <div class="fee_box"><span class="table_txt">数据库名称：</span><span style="width:280px; float:left;"><input name="database[2]" type="text" id="database" value=""  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">数据库账号：</span><span style="width:280px; float:left;"><input name="database[3]" type="text" id="database" value=""  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">数据库密码：</span><span style="width:280px; float:left;"><input name="database[4]" type="text" id="database" value=""  autocomplete="off" class="layui-input" placeholder="" ></span></div>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right">控制面板：</td>
	  <td width="80%">
       <div class="fee_box"><span class="table_txt">面板账号：</span><span style="width:280px; float:left;"><input name="panel[0]" type="text" id="panel" value=""  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">登录账号：</span><span style="width:280px; float:left;"><input name="panel[1]" type="text" id="panel" value=""  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">登录密码：</span><span style="width:280px; float:left;"><input name="panel[2]" type="password" id="panel2" value=""  autocomplete="off" class="layui-input" placeholder="" >
       <input name="showpwd3" type="text" id="showpwd3" value="" style="display:none;" class="layui-input" placeholder="">
       </span>
       <span class="ico_eye" id="look_panel">&nbsp;</span>
       </div>
      </td>
    </tr>
    <tr>
	     <td align="right">排序：</td>
	     <td><span class="table_txt"><input type="text" name="listorder" value="0" class="layui-input" style="width:50px;"></span>
            <span class="table_txt"><font color="#666666">（越大越靠前）</font></span></td>
      </tr>
	  <td align="right"><font color=red size="1">·</font>添加时间：</td>
	  <td><input name="inputtime" type="text" id="inputtime" value="{$now|date='Y-m-d H:i:s',###}"  autocomplete="off" class="layui-input ico-date"  style="width:250px; float:left;"></td>
	  </tr>
    <tr> 
	  <td colspan=2 align="center" valign="middle">
		<input type="submit" name="Submit" value="确&nbsp; &nbsp;定" class="layui-btn" >
		<input type="reset" name="Submit2" value="重　置" class="layui-btn layui-btn-primary" >		 </td>
	</tr>
    </table>
</div>
</form>
<script>
//Demo
layui.use(['form','laydate'], function(){
 var form = layui.form
  ,laydate = layui.laydate;
   var active = {
       notice: function(){
		  layer.open({
			type: 1
			,title: '新增虚拟主机' //不显示标题栏
			,closeBtn: 2
			,area: ['680px','550px']
			,shade: 0.4
			,id: 'LAY_layuipro' //设定一个id，防止重复弹出
			//,btn: ['提交', '关闭']
			,btnAlign: 'c'
			,moveType: 1 //拖拽模式，0或者1
			,content: $("#host_add"),
            })
       }
   }
   
    $('.layui-btn-group .layui-btn').on('click', function(){
		var othis = $(this), method = othis.data('method');
		active[method] ? active[method].call(this, othis) : '';
	  });

  //监听提交
  form.on('submit(btnDel)', function(data){
    //layer.msg(JSON.stringify(data.field));
	title: '最终的提交信息'
	return true;
  });
  
  laydate.render({
    elem: '#inputtime'
	,type: 'datetime'
  });
  laydate.render({
    elem: '#hoststart'
  });
  laydate.render({
    elem: '#hostend'
  });
  
  /*查看密码*/
  $("#look_panel").click(function(){
	  $("#panel2").hide();
	  $("#showpwd3").val($("#panel2").val()).show();
	  var timer = setTimeout(function(){
					  $("#panel2").show();
					  $("#showpwd3").hide();
				  }, 3000);
	
	 // $(this).html($pwd)
  });
});
</script>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>